<?php
/*
 * =====================================================================================
 *
 *       Filename: setting.php 
 *
 *    Description: 定义全局变量，如数据库$db,
 *
 *        Version:  1.0
 *        Created:  05/15/2011 12:29:39 PM
 *
 *         Author:  rainphp@gmail.com
 *        Company:  Anonymous
 *
 * =====================================================================================
 */

#设置变量
define( 'INCL', 'include' );

require_log();
require_db();

require( ABSPATH . INCL . '/class-http.php' );
#require( ABSPATH . INCL . '/class-phpmailer.php' );
#require( ABSPATH . INCL . '/class-smtp.php' );
require( ABSPATH . INCL . '/my_page.php' );
require( ABSPATH . INCL . '/my_picture.php' );

#全局变量
/**
 * Load the correct database class file.
 *
 * This function is used to load the database class file. 
 * We must globalize $wpdb to ensure that it is
 * defined globally by the inline code in wp-db.php.
 *
 * @since 2.5.0
 * @global $db  Database Object
 */
function require_db() {
	global $mydb;

	require_once( ABSPATH . INCL . '/class-db.php' );
	if ( isset( $mydb ) )
		return;

	$mydb = new MyDB( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST );
}


function require_log() {
	global $mylog;

	require_once( ABSPATH . INCL . '/class-log.php' );
	if ( isset( $mylog ) )
		return;

	$mylog = new MyLog( ABSPATH . 'log.txt' );
}

?>
